package com.kan.awaits.mongo;

import java.io.Serializable;

import com.kan.awaits.mongo.annotations.Entity;
import com.kan.awaits.mongo.meta.DBObjectTransformer;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.WriteConcern;
import com.mongodb.WriteResult;

public class DatastoreImpl implements Datastore
{
	private Configuration configuration;

	public boolean delete(Object entity) throws DatastoreException
	{
		Class<?> type = entity.getClass();
		type.isAnnotationPresent(Entity.class);
		DBCollection dbCollection = getCollection("cname");

		DBObject dbObject = DBObjectTransformer.toDbObject(entity, null);

		// dbCollection.remove(o);

		WriteResult writeResult = dbCollection.save(dbObject);

		String error = writeResult.getError();
		// TODO Auto-generated method stub
		return false;
	}

	public boolean delete(Class<?> type, Serializable id) throws DatastoreException
	{
		// TODO Auto-generated method stub
		return false;
	}

	public void ensureCaps()
	{
		// TODO Auto-generated method stub

	}

	public boolean exists(Class<?> type, Serializable id) throws DatastoreException
	{
		// TODO Auto-generated method stub
		return false;
	}

	public <T> T get(Class<T> type, Serializable id)
	{
		// TODO Auto-generated method stub
		return null;
	}

	public DBCollection getCollection(Class<?> c)
	{
		// TODO Auto-generated method stub
		return null;
	}

	public DB getDB()
	{
		// TODO Auto-generated method stub
		return null;
	}

	public WriteConcern getDefaultWriteConcern()
	{
		// TODO Auto-generated method stub
		return null;
	}

	public Mongo getMongo()
	{
		// TODO Auto-generated method stub
		return null;
	}

	public Serializable save(Object object) throws DatastoreException
	{
		return null;
	}

	public void setDefaultWriteConcern(WriteConcern wc)
	{
		// TODO Auto-generated method stub

	}

	public void update(Object object) throws DatastoreException
	{
		// TODO Auto-generated method stub

	}

	public DBCollection getCollection(String collectionName)
	{
		// TODO Auto-generated method stub
		return null;
	}
}
